{% macro itemGroup(thumbnail,title,rating) %}
    <div class="item-group">
        <img src="{{ thumbnail }}" alt="" class="thumbnail">
        <p class="item-title">{{ title }}</p>
        <p class="item-rating">
            {# 全星数 #}
            {% set lights = ((rating|int)/2)|int %}
            {# 半星数 #}
            {% set halfsb = (rating|int)%2 %}
            {# 空星数 #}
            {% set grays = 5 - lights - halfsb %}

            {% for light in range(0,lights) %}
                <img src="{{ url_for("static", filename="images/star/star1.png") }}" alt="">
            {% endfor %}
            {% for light in range(0,halfsb) %}
                <img src="{{ url_for("static", filename="images/star/star2.png") }}" alt="">
            {% endfor %}
            {% for light in range(0,grays) %}
                <img src="{{ url_for("static", filename="images/star/star3.png") }}" alt="">
            {% endfor %}
            {{ rating }}
        </p>
    </div>
{% endmacro %}


{% macro listGroup(module_title, items, link="#") %}
    <div class="item-list-group">
        <div class="item-list-top">
            <span class="module-title">电影</span>
            <a href="" class="more-btn">更多</a>
        </div>
        <div class="list-group">
            {% for item in items %}
                {{ itemGroup(item.thumbnail,item.title,item.rating) }}
            {% endfor %}
        </div>
    </div>
{% endmacro %}